package com.baizhi.controller;

import com.baizhi.entity.OrderDetail;
import com.baizhi.service.CartService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;
import java.util.List;
import java.util.Map;

/**
 * @author yystart
 * @create 2019-10-04 17:52
 */
@RestController
@RequestMapping("/cart")
public class CartController {

    @Autowired
    private CartService service;

    @RequestMapping("/selectCart")
    public Map selectCart(HttpSession session){
        return service.selectCart(session);
    }

    @RequestMapping("/insert")
    public Map insert(HttpSession session,Integer productId){
        return service.insert(session,productId);
    }

    @RequestMapping("/selectOne")
    public OrderDetail selectOne(HttpSession session,Integer productId){
        return service.selectOne(session,productId);
    }

    @RequestMapping("/update")
    public Map update(HttpSession session,Integer productId,Integer quantity){
        return service.update(session,productId,quantity);
    }

    @RequestMapping("/delete")
    public Map update(HttpSession session,Integer productId){
        return service.delete(session,productId);
    }

}
